//
//  CustomerDetailViewController2.m
//  WebPDA
//
//  Created by Justin Yip on 10-7-27.
//  Copyright 2010 TenNights.com. All rights reserved.
//

#import "PassengerDetailViewController.h"
#import "Passenger.h"

@implementation PassengerDetailViewController
@synthesize nameLabel;
@synthesize seatLabel;
@synthesize formTable;
@synthesize navBar;

#pragma mark -
#pragma mark View lifecycle


- (void)viewDidLoad {
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    //self.clearsSelectionOnViewWillAppear = NO;
 
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
	
	self.title = @"旅客详细信息";
	
	[formTable loadBundle:@"PassengerDetail"];
	formTable.navigationController = self.navigationController;
	
	formTable.tableView.hidden = YES;
}

-(void)setPassenger:(Passenger *)p {
	formTable.entity = p;
	nameLabel.text = p.name;
	seatLabel.text = p.seat;
	
	formTable.tableView.hidden = NO;
}

-(void)setEditing:(BOOL)editing animated:(BOOL)animated {
	[super setEditing:editing animated:animated];
	[formTable setEditing:editing animated:animated];
}

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

#pragma mark -
#pragma mark Memory management

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Relinquish ownership any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
    // For example: self.myOutlet = nil;
	self.nameLabel = nil;
	self.formTable = nil;
}


- (void)dealloc {
	[navBar release];
	[nameLabel release];
	[seatLabel release];
	[formTable release];
    [super dealloc];
}


@end

